import socket

ip = "localhost"
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.connect((ip, 50000))

try: 
    while True: 
        nachricht = raw_input("Nachricht: ") 
        s.send(nachricht) 
        antwort = s.recv(1024) 
        print "[%s] %s" % (ip,antwort) 
finally: 
    s.close()
